## numpyArray signal class.  This class is a container for numpy.ndarray objects.  sockets are included for assessing the type, and shape of the array.  This is considered a primative type, other classes can inherit but this class only inherits from baseredrvariable

from signals import BaseRedRVariable
import numpy

class numpyArray(BaseRedRVariable):
    def __init__(self, data, parent = None, checkVal = True):
        BaseRedRVariable.__init__(self, data = data, parent = parent, checkVal = False)
        
        if checkVal:
            if type(data) != numpy.ndarray:
                if type(data) == list:
                    try:
                        data = numpy.array(data)
                    except Exception as inst:
                        print inst
                        print type(data)
                        raise Exception, 'Not of numpy array type'
                else:
                    print type(data)
                    raise Exception, 'Not coerceable to array type'
        self.data = data
        self.shape = data.shape
        self.type = type(data)
        
    def getShape(self):
        return self.shape
    def getType(self):
        return self.type
        
    def convertToClass(self, varClass):
        return self